
package com.sinosoft.ptas.control.dto;

import java.util.Arrays;
import java.util.Date;

import com.sinosoft.framework.core.api.domain.UserEntity;
import com.sinosoft.framework.core.common.utils.ajax.ObjectUtil;
/**
 * 用户传输类
 * @author lianWuJun
 * @time   2017年2月23日 上午10:48:54
 */
public class UserData {
	private String id;  //用户编号
	private String oid; // 用户所在机构的编号
	private String username; // 用户帐号
	private String password; // 用户密码
	private String newpassword; // 用户密码
	private String salt; // 盐(加密需要)
	private String name; // 用户姓名
	private String gender; // 用户性别
	private byte[] portrait; // 肖像图片
	private String telephone; // 用户电话
	private String email; // 用户邮箱
	private String state; // 用户状态
	private String creater; // 创建者
	private Date createtime; // 创建时间
	private String updater; // 修改者
	private Date updatetime; // 修改时间
	private String iconText;//图标文本
	private String [] rids; // 角色
	
	public UserData() {}
	
	public UserData(String id, String name, String oid) {
		super();
		this.id = id;
		this.oid = oid;
		this.name = name;
	}
	
	@Override
	public String toString() {
		return "UserData [id=" + id + ", oid=" + oid + ", username=" + username + ", password=" + password
				+ ", newpassword=" + newpassword + ", salt=" + salt + ", name=" + name + ", gender=" + gender
				+ ", portrait=" + Arrays.toString(portrait) + ", telephone=" + telephone + ", email=" + email
				+ ", state=" + state + ", creater=" + creater + ", createtime=" + createtime + ", updater=" + updater
				+ ", updatetime=" + updatetime + ", rids=" + Arrays.toString(rids) + "]";
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String[] getRids() {
		return rids;
	}
	public void setRids(String[] rids) {
		this.rids = rids;
	}
	public String getNewpassword() {
		return newpassword;
	}
	public void setNewpassword(String newpassword) {
		this.newpassword = newpassword;
	}
	public String getOid() {
		return oid;
	}
	public void setOid(String oid) {
		this.oid = oid;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public byte[] getPortrait() {
		return portrait;
	}
	public void setPortrait(byte[] portrait) {
		this.portrait = portrait;
	}
	public String getTelephone() {
		return telephone;
	}
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getCreater() {
		return creater;
	}
	public void setCreater(String creater) {
		this.creater = creater;
	}
	public Date getCreatetime() {
		return createtime;
	}
	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}
	public String getUpdater() {
		return updater;
	}
	public void setUpdater(String updater) {
		this.updater = updater;
	}
	public Date getUpdatetime() {
		return updatetime;
	}
	public void setUpdatetime(Date updatetime) {
		this.updatetime = updatetime;
	}
	public String getIconText() {
		return iconText;
	}
	public void setIconText(String iconText) {
		this.iconText = iconText;
	}
	/**
	 * 传输类转化成实体类
	 * @return UserEntity
	 */
	public UserEntity toEntity(){
		UserEntity userEntity= new UserEntity();
		ObjectUtil.oldToNew(userEntity, this, "serialVersionUID");
		return userEntity;
	}
	
	/**
	 * 实体类转化成传输类
	 */
	public void toUserData(UserEntity userEntity){
		ObjectUtil.oldToNew(this, userEntity, "serialVersionUID");
	}

}